home *** CD-ROM | disk | FTP | other *** search
/ Linux Cubed Series 8: LINUX Games / Linux Cubed Series 8 - LINUX Games.iso / games / video / fly8111-.000 / fly8111- / fly8 / system.c < prev    next >
C/C++ Source or Header  |  1979-12-31  |  1KB  |  72 lines

  1. /* --------------------------------- system.c ------------------------------- */
  2.  
  3. /* This is part of the flight simulator 'fly8'.
  4.  * Author: Eyal Lebedinsky (eyal@ise.canberra.edu.au).
  5. */
  6.  
  7. /* Common system-services.
  8. */
  9.  
  10. #include "fly.h"
  11.  
  12. static Ushort simstack[10] = {0};
  13. static Ushort simindex = 0;
  14.  
  15. extern void FAR
  16. sim_set (void)
  17. {
  18.     simstack[simindex++] = st.flags & SF_SIMULATING;
  19.     st.flags |= SF_SIMULATING;
  20. }
  21.  
  22. extern void FAR
  23. sim_reset (void)
  24. {
  25.     st.flags = (st.flags & ~SF_SIMULATING) | simstack[--simindex];
  26. }
  27.  
  28. LOCAL_FUNC void NEAR
  29. idle_loop (void)
  30. {
  31.     Ulong    t;
  32.  
  33.     if ((st.flags & SF_SIMULATING) || !(st.flags & SF_INITED))
  34.         return;
  35.     st.flags |= SF_SIMULATING;
  36.  
  37.     t = (Tm->Milli () - st.big_bang) - st.present;
  38.     if (VIS_ALTERNATING == st.stereo) {    /* limit refresh rate */
  39.         if (t < REFRESH/2)
  40.             goto ret;
  41.     } else if ((st.flags1 & SF_DBUFFERING) && !(st.network & NET_ON)) {
  42.         if (t < 10)
  43.             goto ret;
  44.     } else if (t < REFRESH)
  45.         goto ret;
  46.  
  47.     active_loop (t);        /* do one video frame */
  48.     log_flush (0);
  49. ret:
  50.     st.flags &= ~SF_SIMULATING;
  51. }
  52.  
  53. extern void FAR
  54. sys_poll (int id)
  55. {
  56.     Ulong        thistime;
  57.  
  58.     if (st.lasttime != (thistime = Tm->Milli () - st.big_bang)) {
  59.         st.lasttime = thistime;
  60.         if (Sys->Poll)
  61.             Sys->Poll ();
  62.         if (Snd->Poll)
  63.             Snd->Poll (0);
  64.         netports_poll ();
  65.         idle_loop ();
  66.     }
  67. }
  68.  
  69. extern void FAR
  70. iefbr14 (void)
  71. {}
  72.